home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Presentations / Presentations ’93 / Macintosh as Internet Server ƒ / inetd / InetD.h < prev    next >
Encoding:
Text File  |  1993-04-07  |  2.1 KB  |  83 lines  |  [TEXT/MPS ]

  1. //---------------------------------------------------------------------
  2. //
  3. //    Copyright © 1992 David Peterson.
  4. //    All rights reserved.
  5. //
  6. //    Permission to use, copy, modify, and distribute this software for
  7. //    any purpose and without fee is hereby granted, provided that the
  8. //    above copyright notice appear in all copies and that both that
  9. //    copyright notice and this permission notice appear in supporting
  10. //    documentation.
  11. //
  12. //---------------------------------------------------------------------
  13.  
  14. #ifndef __MYUTILS__
  15. #include <myUtils.h>
  16. #endif
  17.  
  18. #ifndef __DAEMONAPP__
  19. #include <DaemonApp.h>
  20. #endif
  21. #ifndef __FILES__
  22. #include <Files.h>
  23. #endif
  24. #ifndef __MACTCPCOMMONTYPES__
  25. #include <MacTCPCommonTypes.h>
  26. #endif
  27.  
  28. #define kFileNames        128
  29. #define kPrepFile        1
  30. #define kLogFile        2
  31.  
  32. #define kLaunchFailure    128
  33.  
  34. #define SwitchResFile(newfile)        CurResFile(); UseResFile(newfile);
  35.  
  36. class TCPListener;
  37. class UDPListener;
  38.  
  39. class InetD : public DaemonApp {
  40. typedef DaemonApp Inherited;
  41. public:
  42.     FSSpec            fPrepFile;
  43.     short            fLogFile;
  44.     
  45.     TCPListener*    fTCP;
  46.     UDPListener*    fUDP;
  47.     
  48.     short            fDriverRef;
  49.         
  50.                     InetD();
  51.     virtual            ~InetD();
  52.             
  53.     void            LogIt(Boolean postit, char* form, ...);
  54.             
  55.     short            GetDriver()            { return fDriverRef; }
  56.     void            NewTCPListener();
  57.     void            NewUDPListener();
  58.  
  59.     Boolean            IsRunning(Str63 name, PSNPtr psn);
  60.     void            Launch(StreamPtr stream, FSSpecPtr process, AEEventID type, PSNPtr psn);
  61.  
  62.     virtual void    InstallAEHandlers();
  63.     virtual void    Initialize();
  64.     
  65.     virtual void    DoNull();
  66. };
  67.  
  68. extern "C" {
  69.     Boolean            CheckSystem();
  70.  
  71.     #pragma parameter TurnOnInterrupts(__D0)
  72.     void            TurnOnInterrupts(short old)    = { 0x46C0 };    // move d0,sr
  73.  
  74.     short            TurnOffInterrupts()    = { 0x40C0,                // move sr,d0
  75.                                             0x007C, 0x0700 };    // ori.w #$0700,sr
  76.         
  77.     pascal OSErr     AEDeathHandler(AppleEvent *messagein, AppleEvent *reply, long refIn);
  78.     pascal OSErr    AETCPNotificationHandler(AppleEvent *messagein, AppleEvent *reply, long refIn);
  79.     pascal OSErr    AEUDPNotificationHandler(AppleEvent *messagein, AppleEvent *reply, long refIn);
  80.     pascal OSErr    AEResetHandler(AppleEvent *messagein, AppleEvent *reply, long refIn);
  81. };
  82.  
  83.